package cn.com.taiji.oospub.wechat.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonValue;
import com.github.dreamyoung.mprelation.EntityMapper;
import com.github.dreamyoung.mprelation.JoinColumn;
import com.github.dreamyoung.mprelation.ManyToOne;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author 
 * @since 2020-10-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class FoodPriceInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableField("ID")
    private String id;

    @TableField("School_Id")
    private String schoolId;

    @TableField("Food_Id")
    private String foodId;

    @TableField(exist = false)
    @EntityMapper
    @ManyToOne
    @JoinColumn(name = "Food_Id",referencedColumnName = "ID")
    private FoodBaseInfo food;

    @TableField("Start_Time")
    private LocalDateTime startTime;

    @TableField("End_Time")
    private LocalDateTime endTime;

    @TableField("Price")
    private Double Price;

    @TableField("Status")
    private PriceStatus Status;

    @TableField("Remark")
    private String Remark;

    @TableField("Creator")
    private String Creator;

    @TableField("Create_Time")
    private LocalDateTime createTime;

    private Double marketPrice;

    private Integer maxNum;

    //临时字段
    @TableField(exist = false)
    private String quantity;

    public enum PriceStatus
    {
        INIT("未生效") {},
        NORMAL("已生效") {},
        INVALID("已失效") {};

        @JsonValue
        private String value;

        private PriceStatus(String value)
        {
            this.value = value;
        }

        public String getValue()
        {
            return value;
        }

    }


}
